#ifndef PORTABLE_DESERIALIZER_H_
#define PORTABLE_DESERIALIZER_H_

#include <iostream>
#include <string_view>

#include "src/pbc/portable-format-helper.h"

namespace portable {

class PbcDeserializer {
 public:
  PbcDeserializer() = default;
  const PbcScript* Run(const uint8_t* buffer, uint32_t length) {
    (void)length;
    const PbcScript* pbc_script = reinterpret_cast<const PbcScript*>(buffer);
#ifdef DEBUG
    Verify(pbc_script);
#endif
    return pbc_script;
  }
  void Verify(const PbcScript* pbc_script) const {
    const PbcHeader& header = pbc_script->GetHeader();
    P_CHECK(header.u16string_storage_offset_ % kAlignU16String == 0);
  }
};

}  // namespace portable

#endif  // PORTABLE_DESERIALIZER_H_